import { BrowserWindow } from 'electron'
import { is } from '@electron-toolkit/utils'
import { windowConfig } from '../config/window'

let adminWindow = null

export function createAdminWindow() {
  adminWindow = new BrowserWindow(windowConfig.admin)

  adminWindow.on('ready-to-show', () => {
    adminWindow.show()
  })

  if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
    adminWindow.loadURL(`${process.env['ELECTRON_RENDERER_URL']}/#/admin`)
  } else {
    adminWindow.loadFile(join(__dirname, '../../renderer/index.html'), {
      hash: '/admin'
    })
  }

  return adminWindow
} 